/* Save Gallery */
function checkFormSave(i)
{
	var id = 'intOrder';
	id = i ? (id+'_'+i) : id;
	var e = $('#'+id);
	if(!e.val())
	{
		e.focus();
		return false;
	}
	
	showWaiting();
	return true;
}

function displayError(id, v)
{
	var i = (v==1) ? ('err_'+id) : ('exists_'+id);
	$('span.err_msg').hide();
	$('#'+i).show();
}

function saveDone(v)
{
	var e = $('form[name=frmSearch]');
	if(e)
	{
		if(!v)
		{
			var ePage = $('form[name=frmSearch] input[name=page]');
			if(ePage)
			{
				ePage.val('1');
			}
		}
		e.submit();
	}
	hideBlockUI();
}
/* Save Gallery */

var gCName = 'gallery';
function doAction(act, act_value, id)
{
	var strListId = '';
	strListId = (id==0) ? getListCheckedValue('chk') : id;
	if (strListId)
	{
		var isCookie = gFunction.readCookie(v_cookieShowConfirm);
		if ( !isCookie )
		{
			var msg = getMsg(act);
			if (msg)
			{
				showConfirm(msg, act, act_value, strListId, gCName);
			}
		}
		else
		{
			doActionOnForm(act, act_value, strListId, gCName);
		}
	}
}

function getMsg(act)
{
	var msg = '';
	if(act=='update-status')
	{
		msg = gLang.gallery['msg_update_active'];
	}
	else if(act=='delete')
	{
		msg = gLang.gallery['msg_delete'];
	}
	return msg;
}